/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejb.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Trasheur
 */
@Entity
@Table(name = "OPERATIONS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Operations.findAll", query = "SELECT o FROM Operations o"),
    @NamedQuery(name = "Operations.findByIdOperation", query = "SELECT o FROM Operations o WHERE o.idOperation = :idOperation"),
    @NamedQuery(name = "Operations.findByTypeOperation", query = "SELECT o FROM Operations o WHERE o.typeOperation = :typeOperation"),
    @NamedQuery(name = "Operations.findByDateDeCreation", query = "SELECT o FROM Operations o WHERE o.dateDeCreation = :dateDeCreation"),
    @NamedQuery(name = "Operations.findByDateDExecution", query = "SELECT o FROM Operations o WHERE o.dateDExecution = :dateDExecution"),
    @NamedQuery(name = "Operations.findByIdCompteSource", query = "SELECT o FROM Operations o WHERE o.idCompteSource = :idCompteSource"),
    @NamedQuery(name = "Operations.findByIdCompteCible", query = "SELECT o FROM Operations o WHERE o.idCompteCible = :idCompteCible"),
    @NamedQuery(name = "Operations.findByIdCompteSourceNotExec", query = "SELECT o FROM Operations o WHERE o.idCompteSource = :idCompteSource AND o.dateDExecution IS NOT NULL"),
    @NamedQuery(name = "Operations.findByIdCompteCibleNotExec", query = "SELECT o FROM Operations o WHERE o.idCompteCible = :idCompteCible AND o.dateDExecution IS NOT NULL"),
    @NamedQuery(name = "Operations.findByMontant", query = "SELECT o FROM Operations o WHERE o.montant = :montant"),
    @NamedQuery(name = "Operations.findLast", query = "SELECT o FROM Operations o WHERE o.idOperation IN (SELECT MAX(c.idOperation) FROM Operations c)")})
public class Operations implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_OPERATION")
    private Integer idOperation;
    @Size(max = 50)
    @Column(name = "TYPE_OPERATION")
    private String typeOperation;
    @Column(name = "DATE_DE_CREATION")
    @Temporal(TemporalType.DATE)
    private Date dateDeCreation;
    @Column(name = "DATE_D_EXECUTION")
    @Temporal(TemporalType.DATE)
    private Date dateDExecution;
    @Column(name = "ID_COMPTE_SOURCE")
    private Integer idCompteSource;
    @Column(name = "ID_COMPTE_CIBLE")
    private Integer idCompteCible;
    @Column(name = "MONTANT")
    private Integer montant;

    public Operations() {
    }

    public Operations(Integer idOperation) {
        this.idOperation = idOperation;
    }

    public Integer getIdOperation() {
        return idOperation;
    }

    public void setIdOperation(Integer idOperation) {
        this.idOperation = idOperation;
    }

    public String getTypeOperation() {
        return typeOperation;
    }

    public void setTypeOperation(String typeOperation) {
        this.typeOperation = typeOperation;
    }

    public Date getDateDeCreation() {
        return dateDeCreation;
    }

    public void setDateDeCreation(Date dateDeCreation) {
        this.dateDeCreation = dateDeCreation;
    }

    public Date getDateDExecution() {
        return dateDExecution;
    }

    public void setDateDExecution(Date dateDExecution) {
        this.dateDExecution = dateDExecution;
    }

    public Integer getIdCompteSource() {
        return idCompteSource;
    }

    public void setIdCompteSource(Integer idCompteSource) {
        this.idCompteSource = idCompteSource;
    }

    public Integer getIdCompteCible() {
        return idCompteCible;
    }

    public void setIdCompteCible(Integer idCompteCible) {
        this.idCompteCible = idCompteCible;
    }

    public Integer getMontant() {
        return montant;
    }

    public void setMontant(Integer montant) {
        this.montant = montant;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idOperation != null ? idOperation.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Operations)) {
            return false;
        }
        Operations other = (Operations) object;
        if ((this.idOperation == null && other.idOperation != null) || (this.idOperation != null && !this.idOperation.equals(other.idOperation))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ejb.Operations[ idOperation=" + idOperation + " ]";
    }
}
